<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="c_produce" :rules="rules" label-width="100px" id="mvcfm">
          <div class="form-unit">
            <span class="mvc-title-left"> 合同商品 </span>
          </div>
          <el-table :data="c_produce">
            <el-table-column label="商品名称" prop="">
              <template slot-scope="scope">
                <el-input v-model="scope.row.product_name" />
              </template>
            </el-table-column>
            <el-table-column label="商品型号" prop="">
              <template slot-scope="scope">
                <el-input v-model="scope.row.product_model" />
              </template>
            </el-table-column>
            <el-table-column label="商品规格" prop="">
              <template slot-scope="scope">
                <el-input v-model="scope.row.product_norm" />
              </template>
            </el-table-column>
            <el-table-column label="商品价格" prop="">
              <template slot-scope="scope">
                <el-input v-model="scope.row.product_price" />
              </template>
            </el-table-column>
          </el-table>
          <el-button @click="contractProductAddSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
          <el-button @click="gotoPage('/psi/supplychainmana/ContractPurchase?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>取消</el-button>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'采购合同'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'ContractProductAdd',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        c_produce: [],
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.loadContainerMenu({
        pid: "80299289AF2443B18EA545A4C0C37170",
        name: "客户管理右菜单",
        selected: "采购合同"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      contractProductAddSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/psi/supplychainmana/SupplierModule/contractProductAddSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/psi/supplychainmana/ContractPurchase/contractPurchase?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
    },
  }
</script>
